package com.howard.webapp.familymanagement.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.google.gson.Gson;
import com.howard.webapp.familymanagement.domain.Menu;
import com.howard.webapp.familymanagement.service.BaseService;
import com.howard.webapp.familymanagement.service.MenuService;

@Controller
@RequestMapping(value = "/menu")
public class MenuController extends BaseController<Menu, Long>{
	
	// 服务类
	@Autowired
	private MenuService service; 
	
	@Override
	protected BaseService<Menu, Long> getService() {
		return service;
	}
	
	@ResponseBody
	@RequestMapping(value = "/findAllMenu")
	public String findAllMenu() 
	{
		Gson gson = new Gson();
	    String allMenu = gson.toJson(service.findAllMenu());
	    System.out.println("all menu="+allMenu);
		return allMenu;
	}
	
}
